import pandas as pd
with open('restr_sites.txt', 'w') as out:
t = pd.read_csv('TypeII_REs.tsv', sep='\t', header=0)
sites = list(t['Recognition site'].unique())
for site in sites:
if len(site) <= 2:
sites.remove(site)
print(' '.join([site for site in sites]), file=out)
import pandas as pd
with open('most_underepr_sites.txt', 'w') as out:
t = pd.read_csv('output.tsv', sep='\t', header=0)
t = t[t['O/E ratio (BCK)'] < 0.8]
print('\n'.join([site for site in list(t['Site'])]), file = out)
unrep_sites = list(t['Site'])
print(unrep_sites)
['GGATCC', 'CTAG', 'CCTAGG']
t = pd.read_csv('endon_ex_heads.tsv', sep='\t', header=0)
unrep_sites = ['GGATCC', 'CTAG', 'CCTAGG']
u = t.loc[t['Recognition site'].isin(unrep_sites)]
u.to_csv('endon_underepr_ex.tsv', sep='\t', index=False)
!jupyter nbconvert --to html 'signals and motifs 3.ipynb'
[NbConvertApp] Converting notebook signals and motifs 3.ipynb to html [NbConvertApp] Writing 574203 bytes to signals and motifs 3.html